var t = getApp();

Page({
    data: {
        codes: [],
        value: "",
        show: !1,
        show1: !1,
        username: ""
    },
    onLoad: function(t) {
        this.getData();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    getData: function() {
        var e = this, o = t.getNetAddresss("plugin.team-dividend.api.index.getCode");
        t._getNetWork({
            url: o,
            success: function(t) {
                var o = t.data;
                1 === o.result ? e.setData({
                    codes: o.data.code
                }) : wx.showToast({
                    title: o.msg,
                    icon: "none"
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    copyCode: function(t) {
        var e = t.currentTarget.dataset.text;
        wx.setClipboardData({
            data: e,
            success: function(t) {
                wx.getClipboardData({
                    success: function(t) {
                        wx.showToast({
                            title: "复制成功",
                            icon: "success",
                            duration: 2e3
                        });
                    }
                });
            }
        });
    },
    goBack: function() {
        wx.navigateBack({
            delta: 1
        });
    },
    codeHistory: function() {
        wx.navigateTo({
            url: "/packageB/member/income/codeHistory/codeHistory"
        });
    },
    openDialog: function() {
        this.setData({
            show1: !0
        });
    },
    onClose: function() {
        this.setData({
            show1: !1
        });
    },
    getUserInfo: function() {
        var e = this;
        if ("" != this.data.username) {
            var o = t.getNetAddresss("plugin.team-dividend.api.index.useCode");
            o += "&code=" + this.data.username, t._getNetWork({
                url: o,
                success: function(o) {
                    t.tips(o.data.msg), 1 === o.data.result ? (e.getData(), e.setData({
                        show1: !1
                    })) : e.setData({
                        show1: !1
                    });
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        } else wx.showToast({
            title: "请输入激活码",
            icon: "none"
        });
    }
});